//
//  Notification+Extensions.swift
//  JTCommon
//
//  Created by Kiyo on 2021/4/2.
//

import Foundation

public extension Notification.Name {
    
    static let languageChanged = Notification.Name(rawValue: "Change_Display_Language")
    
    static let updateReviewByReject = Notification.Name(rawValue: "Noti_updateReviewByReject")
    
    static let updateReviewByPass = Notification.Name(rawValue: "Noti_updateReviewByPass")
    
    static let editEmployeePermissionsSuccess = Notification.Name(rawValue: "Noti_editEmployeePermissionsSuccess")

    static let editMenuPermissionsSuccess = Notification.Name(rawValue: "Noti_editMenuPermissionsSuccess")
    
    static let networkStatusChanged = Notification.Name(rawValue: "Noti_networkStatusChanged")
    
    static let myOrderChanged = Notification.Name(rawValue: "Noti_myOrderChanged")
}

public extension NotificationCenter {
    static func post(_ name: Notification.Name, _ object: Any? = nil) {
        NotificationCenter.default.post(name: name, object: object)
    }
    
    static func addObserver(_ observer: Any, selector: Selector, name: NSNotification.Name?, object: Any? = nil) {
        NotificationCenter.default.addObserver(observer, selector: selector, name: name, object: object)
    }
    
    static func removeObserver(_ observer: Any) {
        NotificationCenter.default.removeObserver(observer)
    }
    
}
